package com.chinatsp.onlineapp.utils;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

/**
 * Activity 切换
 */

public class ActivityUtil {

    public static void intentActivity(Activity context, Class<?> cls, Bundle bundle) {
        Intent intent = new Intent();
        //bundle中的数据传给intent，以传输过去
        if (bundle != null)
            intent.putExtras(bundle);
        intent.setClass(context, cls);
        context.startActivity(intent);
    }

    public static void intentActivity(Activity context, Class<?> cls, Bundle bundle, boolean isFinish) {
        Intent intent = new Intent();
        //bundle中的数据传给intent，以传输过去
        if (bundle != null)
            intent.putExtras(bundle);
        intent.setClass(context, cls);
        context.startActivity(intent);
        if (isFinish)
            context.finish();
    }
}
